package so.sao.code.service.infrastructure.jpa.convert;

import so.sao.code.service.infrastructure.enums.TAG_BATCH_STATUS;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * Created by Administrator on 2017/7/12.
 */
@Converter(autoApply = true)
public class TagBatchStatusConvert implements AttributeConverter<TAG_BATCH_STATUS, Integer> {
    @Override
    public Integer convertToDatabaseColumn(TAG_BATCH_STATUS attribute) {
        return attribute.getValue();
    }

    @Override
    public TAG_BATCH_STATUS convertToEntityAttribute(Integer dbData) {
        return TAG_BATCH_STATUS.fromValue(dbData);
    }
}
